package com.bw.service.impl;

import com.bw.entity.Book;
import com.bw.mapper.BookMapper;
import com.bw.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
// 规范大于规则
@Service  //  业务层 把对象放入容器  唯一标识是 bookServiceImpl
@Component // 通用的类
@Repository // 持久化
@Controller // 控制层
public class BookServiceImpl implements BookService {

    @Autowired // 给属性赋值   （从容器中查找一个对象，给这个属性赋值, 根据属性的类型去查找对象）
           // @Qualifier("bookMapperImpl3") // 指定对象的唯一标识
    BookMapper bookMapper;


    public BookMapper getBookMapper() {
        return bookMapper;
    }

    public void setBookMapper1234567(BookMapper bookMapper) {


        this.bookMapper = bookMapper;
    }

    @Override
    public void addBook(Book book) {
        System.out.println("BookServiceImpl 正在运行 addBook");
        //
        bookMapper.addBook(book);
    }
}
